package com.haizhi.crm.sys.shiro.model;

import com.haizhi.crm.sys.auth.model.UserDo;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by yangyijun on 18/7/3.
 */
@Data
public class UserRoleVo extends UserVo implements Serializable {
    private static final long serialVersionUID = 2L;
    protected List<RoleVo> roles;

    public UserRoleVo(UserDo user) {
        super(user);
        this.roles = new ArrayList<>();
//        if (user.getRoles() != null) {
//            for (Position role : user.getRoles()) {
//                this.roles.add(new RoleVo(role));
//            }
//        }
    }

    /**
     * Use for shiro-redis(crazycake) cacheManager.principalIdFieldName
     **/
    public Long getId() {
        return super.getId();
    }
}
